home *** CD-ROM | disk | FTP | other *** search
- on loadScreenData screen
- global gCurrentScreen, gCurrentStyle, gCurrentPalette, gScreenList, gWorkshopRecord, gLastScreen, gLastStyle, gLastPalette, gCurrentDatabase, gJumpHome
- cursor(4)
- if screen = "SCN0002" then
- set screen to gJumpHome
- end if
- set gLastScreen to gCurrentScreen
- set gLastStyle to gCurrentStyle
- set gLastPalette to gCurrentPalette
- set screenNumber to value(char 4 to 7 of screen)
- set databaseSection to integer(screenNumber / 100)
- set lineNumber to screenNumber - (databaseSection * 100) + 1
- set databasePointer to gCurrentDatabase + databaseSection
- set screenData to line lineNumber of field databasePointer
- set gCurrentScreen to item 1 of screenData
- set gCurrentStyle to item 2 of screenData
- set whichPalette to integer(item 3 of screenData)
- set gScreenList to list(EMPTY)
- set itemCounter to 4
- repeat while itemCounter <= the number of items in screenData
- set listPosition to item itemCounter of screenData
- set listValue to item itemCounter + 1 of screenData
- if listPosition = 1 then
- set gJumpHome to listValue
- else
- if listPosition = 18 then
- set menuNumber to integer(listValue)
- else
- if listPosition = 19 then
- set menuItem to integer(listValue)
- put "1" into item menuItem * 2 of line menuNumber of field gWorkshopRecord
- else
- if (char 1 of listValue = "S") or (char 1 of listValue = "P") then
- setAt(gScreenList, value(listPosition), listValue)
- else
- setAt(gScreenList, value(listPosition), integer(listValue))
- end if
- end if
- end if
- end if
- set itemCounter to itemCounter + 2
- end repeat
- set palCast to getAt(gScreenList, whichPalette)
- if palCast = -1 then
- set palCast to 209
- end if
- set gCurrentPalette to the palette of cast palCast
- end
-
- on puppetState startSprite, endSprite, state
- set spriteCounter to startSprite
- repeat while spriteCounter <= endSprite
- if the puppet of sprite spriteCounter <> state then
- puppetSprite(spriteCounter, state)
- end if
- set spriteCounter to spriteCounter + 1
- end repeat
- end
-
- on spriteVisible startSprite, endSprite, state
- set spriteCounter to startSprite
- repeat while spriteCounter <= endSprite
- if the visible of sprite spriteCounter <> state then
- set the visible of sprite spriteCounter to state
- end if
- set spriteCounter to spriteCounter + 1
- end repeat
- end
-
- on replaceSprite startSprite, endSprite, update
- global gScreenList
- repeat with spriteCounter = startSprite to endSprite
- set castNumber to getAt(gScreenList, spriteCounter)
- if (castNumber <> 0) and (the castNum of sprite spriteCounter <> castNumber) then
- set the castNum of sprite spriteCounter to castNumber
- if update = 1 then
- updateStage()
- end if
- end if
- end repeat
- if update = 2 then
- updateStage()
- end if
- updateStage()
- end
-
- on soundMoreText
- global gScreenList, gBTN041U, gBTN042U
- if getAt(gScreenList, 27) <> 0 then
- set the castNum of sprite 27 to gBTN041U
- end if
- if getAt(gScreenList, 28) <> 0 then
- set the castNum of sprite 28 to gBTN042U
- end if
- end
-
- on paletteSwap
- global gPaletteSwapping, gLastPalette, gCurrentPalette
- if gPaletteSwapping = 0 then
- exit
- end if
- if gLastPalette <> gCurrentPalette then
- puppetPalette(gCurrentPalette, 60)
- end if
- updateStage()
- end
-
- on upDownToggle
- global gSpriteNumber, gValid, gOffsetBtnU, gOffsetBtnD, gOffsetBtnG, gDUMMY_G
- cursor(4)
- set castNumber to the castNum of sprite gSpriteNumber
- if (castNumber >= gOffsetBtnD) and (castNumber < gOffsetBtnU) then
- set castNumber to castNumber - gOffsetBtnD + gOffsetBtnU
- set the castNum of sprite gSpriteNumber to castNumber
- set gValid to 1
- else
- if (castNumber >= gOffsetBtnU) and (castNumber < gOffsetBtnG) then
- set castNumber to castNumber - gOffsetBtnU + gOffsetBtnD
- set the castNum of sprite gSpriteNumber to castNumber
- set gValid to 1
- else
- if (castNumber >= gOffsetBtnG) or (castNumber = gDUMMY_G) then
- set gValid to 0
- end if
- end if
- end if
- updateStage()
- cursor(-1)
- end
-
- on jump
- global gJumpFlag, gCurrentStyle, gLastPalette, gPaletteSwapping
- set gJumpFlag to 0
- if gPaletteSwapping then
- puppetPalette(gLastPalette, 60)
- end if
- go(gCurrentStyle)
- end
-
- on jumpButton
- global gSpriteNumber, gJumpToScreen, gJumpFlag, gScreenList
- set gJumpFlag to 1
- set gJumpToScreen to getAt(gScreenList, gSpriteNumber + 50)
- end
-
- on popUpMouseDown
- global gSpriteNumber
- set gSpriteNumber to the clickOn
- if (gSpriteNumber >= 29) and (gSpriteNumber <= 48) then
- upDownToggle()
- end if
- end
-
- on popUpMouseUp
- global gSpriteNumber, gValid, gBookMarkCast
- if (gSpriteNumber >= 29) and (gSpriteNumber <= 48) and (gValid = 1) then
- if the castNum of sprite gSpriteNumber = gBookMarkCast then
- handleBookMark()
- exit
- end if
- upDownToggle()
- popUpMenu(0)
- jumpButton()
- else
- popUpMenu(0)
- end if
- end
-
- on popUpMenu state
- global gActivePopUp, gLastMouseDownScript, gLastMouseUpScript, gPopUpState, gOffsetBtnD, gOffsetBtnU
- cursor(4)
- if gActivePopUp = 2 then
- popUpMenuVisible(29, 33, state)
- else
- if gActivePopUp = 3 then
- popUpMenuVisible(34, 39, state)
- else
- if gActivePopUp = 4 then
- popUpMenuVisible(40, 40, state)
- else
- if (gActivePopUp = 8) or (gActivePopUp = 13) then
- popUpMenuVisible(44, 47, state)
- end if
- end if
- end if
- end if
- set gPopUpState to state
- if state = 1 then
- saveMouseScripts()
- set the mouseDownScript to "popUpMouseDown"
- set the mouseUpScript to "popUpMouseUp"
- else
- set castNumber to the castNum of sprite gActivePopUp
- set the castNum of sprite gActivePopUp to castNumber - gOffsetBtnD + gOffsetBtnU
- restoreMouseScripts()
- end if
- updateStage()
- cursor(-1)
- end
-
- on popUpMenuVisible startSprite, endSprite, state
- global gScreenList, gDUMMY_G, gOffsetBtnD, gOffsetBtnU
- repeat with spriteCounter = startSprite to endSprite
- set castNumber to getAt(gScreenList, spriteCounter)
- if castNumber <> 0 then
- if state = 0 then
- set the castNum of sprite spriteCounter to gDUMMY_G
- next repeat
- end if
- set the castNum of sprite spriteCounter to castNumber
- end if
- end repeat
- end
-
- on preLoadScreenData
- global gReadAhead, gScreenList, gStyleData, gCurrentDatabase, gStyle8Cast
- if gReadAhead = 0 then
- exit
- end if
- set screen to getAt(gScreenList, 55)
- set screenNumber to value(char 4 to 7 of screen)
- if screenNumber = 2 then
- exit
- end if
- set databaseSection to integer(screenNumber / 100)
- set lineNumber to screenNumber - (databaseSection * 100) + 1
- set databasePointer to gCurrentDatabase + databaseSection
- set screenData to line lineNumber of field databasePointer
- set style to value(char 4 to 7 of item 2 of screenData)
- set styleCastNum to getAt(gStyleData, style)
- if styleCastNum = 0 then
- exit
- end if
- preLoadCast(styleCastNum)
- set itemCounter to 4
- repeat while itemCounter <= the number of items in screenData
- set listPosition to item itemCounter of screenData
- set listValue to integer(item itemCounter + 1 of screenData)
- if (listPosition = 12) or ((listPosition = 9) and (styleCastNum = gStyle8Cast)) then
- preLoadCast(listValue)
- else
- if listPosition > 12 then
- exit
- end if
- end if
- set itemCounter to itemCounter + 2
- end repeat
- end
-
- on loadPreLoadDatabase
- global gPreLoadDatabase, gStyleData
- set itemCounter to 1
- repeat while itemCounter <= the number of items in field gPreLoadDatabase
- set listPosition to item itemCounter of field gPreLoadDatabase
- set listValue to item itemCounter + 1 of field gPreLoadDatabase
- setAt(gStyleData, integer(listPosition), integer(listValue))
- set itemCounter to itemCounter + 2
- end repeat
- end
-
- on SoundInterrupt style, which
- global gCurrentStyle
- if (which = 9) or (which = 24) or (which = 25) or (which = 28) then
- return 0
- else
- if (style = 3) and (which = 13) then
- return 0
- else
- if (style = 5) and ((which >= 13) and (which <= 16)) then
- return 0
- else
- if (style = 7) and ((which >= 13) and (which <= 16)) then
- return 0
- else
- return 1
- end if
- end if
- end if
- end if
- end
-